package elephant.application;

import java.net.URL;
import java.net.URLClassLoader;

public class ApplicationClassLoader extends URLClassLoader{

	private ApplicationImage image;
	public ApplicationClassLoader(URL[] urls) {
		super(urls);
	}
	//
	public ApplicationClassLoader(ApplicationImage image){
		super(image.getURLs());
		this.image=image;
	}
	//
	protected String findLibrary(String name) {
		String lib=image.getNativeLibrary(name);
		if (lib!=null) {
			return lib;
		} else if (image.getNativeLibrary("lib" + name + ".so")!=null) {
			return image.getNativeLibrary("lib" + name + ".so");
		} else {
			return null;
		}
	}
}
